package com.cby.android.sample.fragments

import android.os.Bundle
import com.cby.android.library.base.BasePageStateFragment
import com.cby.android.sample.adapter.RollNewsAdapter
import com.cby.android.sample.bean.roll.RollNewsInfoBean
import com.cby.android.sample.model.RollNewsListViewModel
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @description: RollNewsListFragment
 *
 * @author ChenBaoyang
 * @date 4/29/21 10:33
 */
class RollNewsListFragment : BasePageStateFragment<RollNewsListViewModel, RollNewsInfoBean>() {

    private var typeId: Int = 0

    companion object{
        const val KEY_TYPE_ID = "typ-id"

        fun newInstance(typeId: Int): RollNewsListFragment{
            val fragment = RollNewsListFragment()
            val data = Bundle()
            data.putInt(KEY_TYPE_ID, typeId)
            fragment.arguments = data
            return fragment
        }
    }

    override fun parseArgs() {
        typeId = requireArguments().getInt(KEY_TYPE_ID)
    }

    override fun loadData() {
        viewModel!!.typeId = typeId
        super.loadData()
    }

    override fun getAdapter() = RollNewsAdapter()

}